//
//  SESettingListCell.swift
//  SmartEyeForPatient
//
//  Created by qdsg on 2021/4/15.
//

import UIKit

enum SESettingListCellType: Int {
    case update

    var titleText: String {
        switch self {
        case .update: return "检查更新"
        }
    }
}

class SESettingListCell: UITableViewCell {

    static let className = "SESettingListCell"
    static let reuseId = className

    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var detailLabel: UILabel!
    @IBOutlet weak var avatorImgView: UIImageView! {
        didSet {
            avatorImgView.layer.cornerRadius = 4
            avatorImgView.layer.masksToBounds = true
        }
    }
    @IBOutlet weak var arrowImgView: UIImageView!

    var type: SESettingListCellType = .update {
        didSet {
            titleLabel.text = type.titleText
            switch type {
            case .update:
                avatorImgView.isHidden = true
                detailLabel.isHidden = true
                detailLabel.text = "V\(UIDevice.appVersion)"
                arrowImgView.isHidden = true
            }
        }
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    func updateCell(indexPath: IndexPath) {
        type = SESettingListCellType(rawValue: indexPath.row) ?? .update
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
